﻿package Cain.MkMc 
{
	import flash.display.Sprite;
	import flash.events.Event;
	/**
	 * 色塊
	 * @author Cain
	 */
	public class Bk extends Sprite {
		private var ww:Number;
		private var hh:Number;//高
		private var myColor:int;//色彩
		private var myAlpha:Number;//透明度
		/**
		 * 建構 色塊
		 * @param	_ww 寬
		 * @param	_hh 高
		 * @param	_color 色彩
		 * @param	_alpha 透明度
		 */
		public function Bk(_ww:Number = 48,_hh:Number = 48,_color:uint = 0,_alpha:Number = 1) 
		{
			ww = _ww;
			hh = _hh;
			myColor = _color;
			myAlpha = _alpha;
			setup();
		}
		
		private function setup():void
		{
			graphics.beginFill(myColor);
			graphics.drawRect(0, 0, ww, hh);
			graphics.endFill();
			alpha = myAlpha;
			addEventListener(Event.ADDED_TO_STAGE, addthis);
		}
		
		private function addthis(e:Event):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, addthis);
			addEventListener(Event.REMOVED_FROM_STAGE, renovethis);
			init();
		}
		
		private function init():void
		{
			
		}
		
		private function renovethis(e:Event):void 
		{
			removeEventListener(Event.REMOVED_FROM_STAGE, renovethis);
		}
	}
	
}